import request from '@/router/axios';


export const getList = (keyWord,createNames,statusList,pageNo, pageSize) => { // 查询社交自动化列表
  return request({
    url: '/api/blade-marketing/marketingSocialRule/page',
    method: 'get',
    params: {
      keyWord,
      createNames,
      statusList,
      pageNo,
      pageSize
    }
  })
}

export const saveRules = (row) => { // 保存自动化规则
  return request({
    url: '/api/blade-marketing/marketingSocialRule',
    method: 'post',
    data: row
  })
}
export const getDetail = (id) => { // 查询详情
  return request({
    url: `/api/blade-marketing/marketingSocialRule/${id}`,
    method: 'get'
  })
}
export const updateRule = (row) => {//更新
  return request.put(`/api/blade-marketing/marketingSocialRule/${row.id}`, row)
}

//删除
export const deleteRow = (id) => request({ // 删除节点
  url: `api/blade-marketing/marketingSocialRule/${id}`,
  method: 'delete'
})
//共享 /blade-marketing/marketingSocialRule/{id}/enable/{en}
export const changeShare = (id, en) => { //启用开关
  return request.put(`/api/blade-marketing/marketingSocialRule/${id}/share/${en}`)
}
//启用禁用 /blade-marketing/marketingSocialRule/{id}/enable/{en}
export const changeUse = (id, en) => { //启用开关
  return request.put(`/api/blade-marketing/marketingSocialRule/${id}/enable/${en}`)
}
export const copyRule = (id,name) => { //复制/api/blade-marketing/marketingSocialRule/${id}/copy?name=xxxx
  return request.put(`/api/blade-marketing/marketingSocialRule/${id}/copy?name=${name}`)
}
export const getNextMan = () => {
  return request({
    url: '/api/blade-marketing/marketingSocialRule/createNames',
    method: 'get'
  })
}
